package com.project.collectAPI.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.collectAPI.dao.FirstclassDao;
import com.project.collectAPI.entity.Firstclass;
import com.project.collectAPI.service.FirstclassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * (Firstclass)表服务实现类
 *
 * @author makejava
 * @since 2023-06-13 10:56:37
 */
@Service("firstclassService")
public class FirstclassServiceImpl extends ServiceImpl<FirstclassDao, Firstclass> implements FirstclassService {

    FirstclassService firstclassService; //声明使用接口

    @Autowired
    FirstclassDao firstclassDao;

    @Override
    public void SaveFirstClass(List<Firstclass> firstclass) {
        boolean b = firstclassService.saveBatch(firstclass);
    }

    @Override
    public List<Firstclass> getFirstClassByBrandName(String brandName) {
        List<Firstclass> getList=firstclassDao.selectList(new QueryWrapper<Firstclass>().eq("brandname",brandName));
        return !Objects.isNull(getList)?getList:null;
    }

    @Override
    public Firstclass getByFirstId(String firstId) {
        Firstclass data=firstclassDao.selectOne(new QueryWrapper<Firstclass>().eq("firstid",firstId));
        return !Objects.isNull(data)?data:null;
    }
}

